﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sjt_console20200528
{

    class Student:IComparable<Student>
    {
        // 属性
        String stuName;
        int stuAge;

        public Student(string stuName, int stuAge)
        {
            this.stuName = stuName;
            this.stuAge = stuAge;
        }

        public string StuName
        {
            get
            {
                return stuName;
            }

            set
            {
                stuName = value;
            }
        }

        public int StuAge
        {
            get
            {
                return stuAge;
            }

            set
            {
                stuAge = value;
            }
        }

        public int CompareTo(Student other)
        {
            // 默认返回值
            int i = 0;
            // 当前对象大于other
            if (other == null)
            {

                i = 1;
            }
            else
            {
                i = this.StuAge - other.StuAge;
            }
            
            return i * -1;
        }


        // 方法
    }
}
